'use strict'

import {Body, Controller, Inject, Post} from "@midwayjs/decorator";
import {ResourceService} from '../service/resourceService';

@Controller('/resource')
export class ResourceController {
  @Inject()
  resourceService:ResourceService

  @Post('/list')
  async resourceList(){
    const resourceList = await this.resourceService.getList()
    return resourceList;
  }

  @Post('/save')
  async roleSave(@Body('resourceData') data: object) {
    const rs = await this.resourceService.save(data).catch(err => {
      return {
        success: false,
        msg:'保存失败'
      }
    })
    return rs
  }
}
